typedef struct {
	unsigned char goods_type;	//货物类型
	unsigned int goods_count;	//货物数量
}storage_goods_info;

typedef struct {
	unsigned char storage_status;	//仓库开关状态
	unsigned char led_status;		//LED 状态
	unsigned char buzzer_status;	//Buzzer 状态
	unsigned char fan_status;		//风扇状态
	unsigned char seg_status;		//数码管状态
	signed char x;
	signed char y;					//仓库三轴状态
	signed char z;
	char samplingTime[20];			//环境数据采集时间
	float temperature; 				//当前温度
	float temperatureMAX;			//温度上限
	float temperatureMIN;			//温度下限
	float humidity;					//当前湿度
	float humidityMAX;				//湿度上限
	float humidityMIN;				//湿度下限
	float illumination;				//当前光照
	float illuminationMAX;			//光照上限
	float illuminationMIN;			//光照下限
	float battery FS11C14;			//电池电量
	float adc;						//模拟电压
	float adcMIN;					//模拟电压最小值
	storage_goods_info goods_info[GOODS_NUM]; //仓库货物信息
}storage_info;

typedef struct {					//循环链表
	storage_info * pro;
	storage_info storage_no;
	storage_info * next;
}env_info_clien_addr;

typedef struct {
	int table_select_mask;			//数据库表选择掩码
	int env_operation_mask;			//Env 表操作掩码
	int table_operation_mask;		//数据库表操作掩码
	int goods_operation_mask;		//Goods 表操作掩码
}storage_no;

typedef struct {
	long type;						//消息队列里的消息类型
	long msgtype;					//区别消息的类型
	unsigned char text[QUEUE_MSG_LEN]; //消息正文长度
}msg;

storage_info storage_RT[STORAGE_NUM]; //实时信息

unsigned char dev_sms_mask;			//A9 短信模块操作掩码
unsigned char dev_infrared_mask;	//A9 按键模块操作掩码
unsigned char dev_buzzer_mask;		//A9 蜂鸣器模块操作掩码
unsigned char dev_led_mask;			//A9 LED 模块操作掩码
unsigned char dev_camera_mask;		//A9 摄像头模块操作掩码
unsigned char dev_uart_mask;		//A9 串口发送命令掩码

int dev_infrared_fd;				//A9 按键模块设备节点
int dev_buzzer_fd;					//A9 蜂鸣器模块设备节点
int dev_led_fd;						//A9 LED 模块设备节点
int dev_camera_fd;					//A9 摄像头模块设备节点
int dev_sms_fd;						//A9 短信模块设备节点
int dev_uart_fd;					//A9 U 转串设备节点
int msgid;							//消息队列ID
int shmid;							//共享内存ID
int semid;							//信号灯集ID
int storageNum;						//仓库号
int goodsKinds;						//货物种类

env_info_clien_addr env_info_clien_addr_s; //仓库环境信息
env_info_clien_addr all_info_RT;	//实时信息

/*线程名*/
pthread_client_request():处理消息队列里请求的线程.
pthread_refresh():更新共享内存里的实时数据.
pthread_sqlite():数据库线程.
pthread_transfer ():接收数据线程.
pthread_analysis():数据分析线程.
pthread_uart_cmd():控制命令发送线程.
pthread_sms():短信模块控制线程.
pthread_led():A9LED 模块线程.
pthread_camera():摄像头模块控制线程.
phtread_buzzer():A9 蜂鸣器模块线程.

/*条件变量*/
pthread_cond_t cond_sqlite;			//据库线程被唤醒条件变量
pthread_cond_t cond_analysis;		//数据分析线程被唤醒条件变量
pthread_cond_t cond_uart_cmd;		//控制命令发送线程被唤醒条件变量
pthread_cond_t cond_client_request;	//处理消息队列里请求的线程被唤醒条件变量
pthread_cond_t cond_infrared;		//红外(按键模拟)监测线程被唤醒条件变量
pthread_cond_t cond_buzzer; 		//A9 蜂鸣器控制线程被唤醒条件变量
pthread_cond_t cond_led;			//A9 LED 模块线程被唤醒条件变量
pthread_cond_t cond_camera;			//摄像头模块控制线程被唤醒条件变量
pthread_cond_t cond_sms;			//短信模块控制线程被唤醒条件变量	
pthread_cond_t cond_refresh;		//更新共享内存里的实时数据被唤醒条件变量

/*互斥锁*/
pthread_mutex_t mutex_slinklist;	//数据库缓存互斥锁
pthread_mutex_t mutex_sqlite;		//数据库线程互斥锁
pthread_mutex_t mutex_analysis;		//数据分析线程互斥锁
pthread_mutex_t mutex_uart_cmd;		//控制命令发送线程互斥锁
pthread_mutex_t mutex_client_request; //处理消息队列里请求的线程互斥锁
pthread_mutex_t mutex_infrared;		//红外(按键模拟)监测线程互斥锁
pthread_mutex_t mutex_buzzer;		//A9 蜂鸣器控制线程互斥锁
pthread_mutex_t mutex_led;			//A9 LED 模块线程互斥锁
pthread_mutex_t mutex_camera;		//摄像头模块控制线程互斥锁
pthread_mutex_t mutex_sms;			//短信模块控制线程互斥锁
pthread_mutex_t mutex_refresh;		//更新共享内存里的实时数据互斥锁
pthread_mutex_t mutex_refresh_updata; //暂留未用
pthread_mutex_t mutex_global;		//全局变量保护互斥锁
pthread_mutex_t mutex_linklist;		//接收数据缓存互斥锁